//
//  GYOrdetTimeCell.m
//  GoodLuck
//
//  Created by apple on 2018/3/24.
//  Copyright © 2018年 yunjiazhineng. All rights reserved.
//

static NSString *orderTimerCellIdentifier = @"orderTimerCellIdentifier";

#import "GYOrdetTimeCell.h"

@interface GYOrdetTimeCell ()

@property (weak, nonatomic) IBOutlet UILabel *orderNumLable;
@property (weak, nonatomic) IBOutlet UILabel *orderAddTimeLable;
@property (weak, nonatomic) IBOutlet UILabel *orderPayLable;
@property (weak, nonatomic) IBOutlet UILabel *orderDeliverTimeLable;

@end
@implementation GYOrdetTimeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+ (instancetype)cellWithTableView:(UITableView *)tableView {
    GYOrdetTimeCell *cell = [tableView dequeueReusableCellWithIdentifier:orderTimerCellIdentifier];
    
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] firstObject];
        
    }
    
    return cell;
}
- (void)setModel:(GYOrderDetails *)model {
    _model = model;
    
    self.orderNumLable.text = [NSString stringWithFormat:@"订单编号: %@",model.order_sn];
    self.orderAddTimeLable.text = [NSString stringWithFormat:@"创建时间: %@",model.add_time];
    
    self.orderPayLable.text = model.payment_time.length == 0 ? model.payment_time : [NSString stringWithFormat:@"付款时间: %@",model.payment_time];
    self.orderDeliverTimeLable.text = model.finnshed_time.length == 0 ?model.finnshed_time : [NSString stringWithFormat:@"发货时间: %@",model.finnshed_time];
    
}

- (CGFloat)getHeight:(GYOrderDetails *)orderDetails {
    self.model = orderDetails;
    
    [self layoutIfNeeded];
    
    return CGRectGetMaxY(self.orderDeliverTimeLable.frame)+10;
}
@end
